<template>
  <d-table
      db="orm"
      :entity="entity"
      :buttons="buttons"
  >
    <template #header>
      <el-select v-model="entity" style="width: 200px">
        <el-option v-for="e in options" :label="e" :value="e"></el-option>
      </el-select>
    </template>
  </d-table>

  <m-dialog ref="dialog">
    <template #default="{data}">
      {{ data }}
    </template>
  </m-dialog>
</template>

<script setup lang="ts">
import {ref} from "vue";
import type {MTableButton} from "../../morghulis/types/table/m.table.types.ts";

const dialog = ref()
const entity = ref('data.Vala')
const page = ref(1);
const options = [
  'data.Vala',
  'data.M2O',
  'data.O2O',
  'data.M2M',
  'data.Meta',
  'data.MetaField',
  'data.MetaView'
]

// const includes = ref({name: null})
// const queryBean = reactive<QueryBean>({size: 10, page: 1, includes: includes.value})
// const meta = reactive<Meta>({db: 'orm', entity: 'data.MetaField', code: 'rest'})
const buttons: MTableButton[] = [
  {
    title: 'abc', handler: (row) => {
      dialog.value.open(row)
    }
  },
]
// const columns: MTableColumn[] = [
//   {label: '自定义列', component: Something},
// ]


</script>

<style scoped>

</style>